﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Data;
using System.Collections.ObjectModel;


namespace TravelWallet.Converters
{
    /*
    public class GroupToBrushValueConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string stringValue = value.ToString();
            object result = null;

            if (!string.IsNullOrEmpty(stringValue))
            {
                if (group.Count == 0)
                {
                    result = (SolidColorBrush)Application.Current.Resources["PhoneChromeBrush"];
                }
                else
                {
                    result = (SolidColorBrush)Application.Current.Resources["PhoneAccentBrush"];
                }
            }

            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
     * */
}   
namespace TravelWallet.Types
{

    public class Group<T> : List<T>
    {
        public Group(char name, IEnumerable<T> items) : base(items)
        {
            this.Letter = name;
      
        }

       
         
        public char Letter
        {
            get;
            set;
        }

 
    }

    public enum ProgramCategory
    {
        Airlines, Hotels, CarRentals
    }

    public class PartnerGroup
    {
        private string groupName;

        public string Name
        {
            get { return groupName; }
            set { groupName = value; }
        }


        private List<string> partners;
        
        public List<string> Partners
        {
            get { return partners; }
            set { partners = value; }
        }


        public PartnerGroup()
        {
            partners = new List<string>();
        }
    }

    public class Program : INotifyPropertyChanged {
        private long programID;

        public long ProgramID
        {
            get { return programID; }
            set { programID = value; }
        }

       
        private string programName;

        public string ProgramName
        {
            get { return programName; }
            set { programName = value;
            NotifyPropertyChanged("ProgramName");
            
            }
        }


        private string selectedProgram;

        public string SelectedProgram
        {
            get { return selectedProgram; }
            set { selectedProgram = value;
            NotifyPropertyChanged("SelectedProgram");

            }
        }

        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        
        
        private ProgramCategory category;

        public ProgramCategory Category
        {
            get { return category; }
            set { category = value; }
        }


        private PartnerGroup partnerGroup;

        public PartnerGroup PartnerGroup
        {
            get { return partnerGroup; }
            set { partnerGroup = value; }
        }


        public Program() {

            //programName = new List<string>();
            partnerGroup = new PartnerGroup();
        }

        public event PropertyChangedEventHandler PropertyChanged;

       
        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
    }


    public class WalletItem : IEquatable<WalletItem>, INotifyPropertyChanged
    {
        private long id;

        public long ID
        {
            get { return id; }
            set { id = value; }
        }

        private ProgramCategory category;

        public ProgramCategory Category
        {
            get { return category; }
            set { category = value;
            NotifyPropertyChanged("Category");
            }
        }
        private string number;

        public string Number
        {
            get { return number; }
            set { number = value;
            NotifyPropertyChanged("Number");
            }
        }
        private Program program;

        public Program Program
        {
            get { return program; }
            set { program = value;
            NotifyPropertyChanged("Program");
            
            }
        }

        public WalletItem() {
            this.id = default(long);
            this.program = new Program();
        }


        public bool Equals(WalletItem other)
        {
            return (this.ID == other.ID);
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

    }
}
